home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Financial / HousePrice1.0 / Source / FPObject.m < prev    next >
Text File  |  1995-09-06  |  2KB  |  81 lines

  1.  
  2. #import "FPObject.h"
  3.  
  4. @implementation FPObject
  5.  
  6. - Calc:sender
  7. {
  8.  
  9.     char dummyString[20];
  10.     float dummy1;
  11.     float dummy2;
  12.     float askingprice;
  13.     float municipalevaluation;
  14.     float offer;
  15.     float percentasking;
  16.     float percentmunicipal;
  17.  
  18.  
  19. // Assign Variables
  20.  
  21.            askingprice = [AskingPrice floatValue];
  22.     municipalevaluation = [MunicipalEvaluation floatValue];
  23.     offer = [Offer floatValue];
  24.  
  25.  
  26. // This section finds the % in comparision with the
  27. // Asking Price
  28. // Formula is: Offer/Asking Price = X
  29. //             Multiply X by 100 = Y
  30. //             100 - Y = Value we want!    
  31.  
  32.     dummy1 = (offer/askingprice);
  33.         dummy2 = (dummy1 * 100);
  34.         percentasking = (dummy2 - 100);
  35.  
  36.         // Convert float to a string
  37.         sprintf(dummyString, "%.2f", percentasking); 
  38.         // Display result
  39.     [PercentAsking setStringValue:dummyString];
  40.     [PercentAsking display];
  41.  
  42.  
  43. // This section finds the % in comparision with the
  44. // Municipal Evaluation
  45. // Formula is: Offer/Municipal Evaluation = X
  46. //             Multiply X by 100 = Y
  47. //             100 - Y = Value we want!    
  48.  
  49.     dummy1 = (offer/municipalevaluation);
  50.         dummy2 = (dummy1 * 100);
  51.         percentmunicipal = (dummy2 - 100);
  52.  
  53.         // Convert float to a string
  54.         sprintf(dummyString, "%.2f", percentmunicipal); 
  55.         // Display result
  56.     [PercentMunicipal setStringValue:dummyString];
  57.     [PercentMunicipal display];
  58.  
  59.  
  60.     [Offer selectText:self];
  61.  
  62.     return self;
  63. }
  64.  
  65. // AWAKEFROMNIB
  66. // This is one of the last methods executed after the nib file is loaded.
  67. // This is the BEST way I know how to initialize an object and jump into
  68. // a method after the nib file was loaded, because you are all the methods
  69. // and variables needed can be used. (Unlike init which is not compeletly
  70. // ready when that message is sent
  71. - awakeFromNib
  72. {
  73.  
  74.     [FindPercentagePanel makeKeyAndOrderFront:NULL];
  75.     [AskingPrice selectText:self];
  76.  
  77.         return self;
  78. }
  79.  
  80. @end
  81.